<template>
  <CustomTable 
    class="card"
    title="数据列表"
    showAlert
    rowKey="id"
    :dataSource="dataSource" 
    :columns="columns" 
    :loading="loading"
    :selectedRows.sync="selectedRowKeys"
    :downloadDataSource="downloadDataSource"
    :downloadTitle="downloadTitle"
    :defaultCeckedKeys="['pause', 'old_data','campaignNameStatus','userName','campaignStatus','bidType','ocpcBid','budget','schedule','cost','dsOcpcConversionsDetailAmount', 'roi','ds_cvr','dsOcpcConversionsDetail','dsOcpcConversionsDetailCost']"
    :pagination="{showTotal:() => `更新于：${lastUpdateTime} 共 ${total} 条数据`,total:total,showSizeChanger:true,pageSize: pageSize,pageSizeOptions:['10', '20', '30', '40', '50', '100', '1000']}"
    @selectedRowChange="selectedRowChange"
    @change="onChange"
    :scroll="{ x: 800 }"
  >
    <div style="margin-bottom:20px;">
      <!-- 搜索 -->
      <!-- <a-input-search style="width:300px;margin-bottom:20px;" placeholder="输入账户名" enter-button="搜索" @search="goSearch" v-model="keyWord" allowClear/> -->
      <a-select v-model="accountName" style="width: 180px;" @search="accountSelectSearch" show-search >
        <a-select-option :value="0">全部账户</a-select-option>
        <a-select-option :value="item.account" v-for="item in accountData" :key="item.id">{{item.account}}</a-select-option>
      </a-select>
      <a-select v-model="admin_userid" style="width:180px;margin-left: 12px;">
        <a-select-option :value="0">全部优化师</a-select-option>
        <a-select-option :value="item.id" v-for="item in youhuashi" :key="item.id" >
          {{item.username}}
        </a-select-option>
      </a-select>
      <a-select show-search style="width: 180px;margin-left: 12px;" :filter-option="filterOption" v-model="product_name">
        <a-select-option :value="0">全部产品</a-select-option>
        <a-select-option :value="item.value" v-for="item in productList" :key="item.id">{{item.label}}</a-select-option>
      </a-select>
      <a-select v-model="campaignStatus" style="width: 180px;margin-left: 12px;">
        <a-select-option :value="-1">全部状态</a-select-option>
        <a-select-option :value="0">有效</a-select-option>
        <a-select-option :value="1">处于暂停时段</a-select-option>
        <a-select-option :value="2">暂停</a-select-option>
        <a-select-option :value="3">预算不足</a-select-option>
        <a-select-option :value="10">账户预算不足</a-select-option>
        <a-select-option :value="11">账户余额为零</a-select-option>
        <a-select-option :value="20">审核中</a-select-option>
        <a-select-option :value="21">审核不通过</a-select-option>
        <a-select-option :value="22">部分有效</a-select-option>
        <a-select-option :value="30">商品已失效</a-select-option>
      </a-select>
      <a-select value="操作" style="width: 120px;margin-left: 12px;" :disabled="selectedRowsForId.length == 0" @change="actionFunc">
        <a-select-option :value="1">暂停计划</a-select-option>
        <a-select-option :value="2">启动计划</a-select-option>
        <a-select-option :value="3">修改出价</a-select-option>
      </a-select>
      <a-button class="searchView" type="primary" @click="getUserData">
        搜索
      </a-button>
      <a-modal
        title="修改出价"
        :visible="showChangeOcpcBid"
        @ok="changeOcpcBid"
        @cancel="showChangeOcpcBid = false"
      >
        <a-input-number v-model="ocpcBid"  style="width: 200px;"/>
      </a-modal>
    </div>
    <div slot="pause" slot-scope="{record}">
      <a-switch v-model="record.pause" @change="(status) => changePause(record, status)" />
    </div>
    <div class="line1" slot="campaignNameStatus" slot-scope="{record}" style="cursor: pointer;">
      <a-tooltip>
        <template slot="title">
          {{record.campaignNameStatus}}
        </template>
        <span class="line1" style="width: 320px;display: block;">{{record.campaignNameStatus}}</span>
      </a-tooltip>
    </div>
    <div slot="userName" slot-scope="{record}">
      <a :href="'https://shoppingads.baidu.com/shop/manageCenter/dashboard/campaignList/target/0/user/'+record.ucid" target="_blank" style="display: block;cursor: pointer;white-space: nowrap;">{{record.userName}}</a>
    </div>
    <div slot="impression" slot-scope="{record}">
      {{record.impression}} 
      <span v-if="showHB" :class="record.huanbi.impression>0?'fontGreen':'fontRed'">({{record.huanbi.impression}})</span>
    </div>
    <div slot="old_data" slot-scope="{record}">
      <a-tooltip>
        <template slot="title">
          消费：{{ parseFloat(record.old_data.cost).toFixed(2) }}<br>
          成交：{{ parseFloat(record.old_data.gmv).toFixed(2) }}<br>
          ROI：{{ parseFloat(record.old_data.roi).toFixed(2) }}
        </template>
        <div class="old_data">
          <img src="@/assets/img/cost.png"  alt=""> {{ parseFloat(record.old_data.cost).toFixed(2) }}
        </div>
        <a-divider />
        <div class="old_data">
          <img src="@/assets/img/gmv.png"  alt=""> {{ parseFloat(record.old_data.gmv).toFixed(2) }}
        </div>
        <a-divider />
        <div class="old_data">
          <img src="@/assets/img/roi.png"  alt=""> {{ parseFloat(record.old_data.roi).toFixed(2) }}
        </div>
      </a-tooltip>
    </div>
    <div slot="bidType" slot-scope="{record}">
      {{getBidType(record.bidType)}} 
    </div>
    <div slot="budget" slot-scope="{record}" style="cursor: pointer;" >
      <BudgetView :bidType="record.bidType" :userName="record.userName" :campaignId="record.campaignId" :budget="record.budget" @change="init">
        {{record.budget == 0 ? '不限' : (record.budget).toFixed(2)}}
        <a-icon type="edit" />
      </BudgetView>
    </div>
    <div slot="schedule" slot-scope="{record}" style="cursor: pointer;" >
      <ScheduleView :scheduleStr="record.schedule" :userName="record.userName" :campaignId="record.campaignId" :campaignNameStatus="record.campaignNameStatus" @change="init"></ScheduleView>
    </div>
    <div slot="impressionHuanbi" slot-scope="{record}">
      {{record.huanbi.impression}}
    </div>
    <div slot="click" slot-scope="{record}">
      {{record.click}} 
      <span v-if="showHB" :class="record.huanbi.click>0?'fontGreen':'fontRed'">({{record.huanbi.click}})</span>
    </div>
    <div slot="clickHuanbi" slot-scope="{record}">
      {{record.huanbi.click}}
    </div>
    <div slot="ctr" slot-scope="{record}">
      {{(record.ctr*100).toFixed(2) + '%'}}
      <span v-if="showHB" :class="record.huanbi.ctr>0?'fontGreen':'fontRed'">({{record.huanbi.ctr}})</span>
    </div>
    <div slot="ctrHuanbi" slot-scope="{record}">
      {{record.huanbi.ctr}}
    </div>
    <div slot="pct" slot-scope="{record}">
      {{(record.pct).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.pct>0?'fontGreen':'fontRed'">({{record.huanbi.pct}})</span>
    </div>
    <div slot="pctHuanbi" slot-scope="{record}">
      {{record.huanbi.pct}}
    </div>
    <div slot="act" slot-scope="{record}">
      {{(record.act).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.act>0?'fontGreen':'fontRed'">({{record.huanbi.act}})</span>
    </div>
    <div slot="dsOcpcConversionsDetailAmount" slot-scope="{record}">
      {{(record.dsOcpcConversionsDetailAmount).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetailAmount>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetailAmount}})</span>
    </div>
    <div slot="roi" slot-scope="{record}">
      {{(record.roi).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.roi>0?'fontGreen':'fontRed'">({{record.huanbi.roi}})</span>
    </div>
    <div slot="actHuanbi" slot-scope="{record}">
      {{record.huanbi.act}}
    </div>
    <div slot="cost" slot-scope="{record}">
      {{(record.cost).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.cost>0?'fontGreen':'fontRed'">({{record.huanbi.cost}})</span>
    </div>
    <div slot="costHuanbi" slot-scope="{record}">
      {{record.huanbi.cost}}
    </div>
    <div slot="ds_cvr" slot-scope="{record}">
      {{(record.ds_cvr*100).toFixed(2) + '%'}}
      <span v-if="showHB" :class="record.huanbi.ds_cvr>0?'fontGreen':'fontRed'">({{record.huanbi.ds_cvr}})</span>
    </div>
    <div slot="campaignStatus" slot-scope="{record}">
      <div style="display:flex;align-items: center;">
        <div style="width:6px;height:6px;border-radius:50%;background-color:#00cc63" v-if="record.campaignStatus==0"></div>
        <div style="width:6px;height:6px;border-radius:50%;background-color:#ff7875" v-else></div>
        <span style="margin-left:5px">{{setStatus(record.campaignStatus)}}</span>
      </div>
    </div>
    <div slot="dsOcpcConversionsDetail" slot-scope="{record}">
      {{record.dsOcpcConversionsDetail}}
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetail>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetail}})</span>
    </div>
    <div slot="dsOcpcConversionsDetailCost" slot-scope="{record}">
      {{parseFloat(record.dsOcpcConversionsDetailCost).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetailCost>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetailCost}})</span>
    </div>
    <div slot="dsOcpcConversionsDetail80Cost" slot-scope="{record}">
      {{parseFloat(record.dsOcpcConversionsDetail80Cost).toFixed(2)}}
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetail80Cost>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetail80Cost}})</span>
    </div>
    <div slot="dsOcpcConversionsDetail80CostHuanbi" slot-scope="{record}">
      {{record.huanbi.dsOcpcConversionsDetail80Cost}}
    </div>
    <div slot="dsOcpcConversionsDetail80" slot-scope="{record}">
      {{(record.dsOcpcConversionsDetail80)}}
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetail80>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetail80}})</span>
    </div>
    <div slot="dsOcpcConversionsDetail80Huanbi" slot-scope="{record}">
      {{record.huanbi.dsOcpcConversionsDetail80}}
    </div>
    <div slot="dsOcpcConversionsDetail90" slot-scope="{record}">
      {{(record.dsOcpcConversionsDetail90)}} 
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetail90>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetail90}})</span>
    </div>
    <div slot="dsOcpcConversionsDetail90Huanbi" slot-scope="{record}">
      {{record.huanbi.dsOcpcConversionsDetail90}}
    </div>
    <div slot="dsOcpcConversionsDetail90Cost" slot-scope="{record}">
      {{parseFloat(record.dsOcpcConversionsDetail90Cost).toFixed(2)}} 
      <span v-if="showHB" :class="record.huanbi.dsOcpcConversionsDetail90Cost>0?'fontGreen':'fontRed'">({{record.huanbi.dsOcpcConversionsDetail90Cost}})</span>
    </div>
    <div slot="dsOcpcConversionsDetail90CostHuanbi" slot-scope="{record}">
      {{record.huanbi.dsOcpcConversionsDetail90Cost}}  
    </div>
    <div slot="ocpcBid" slot-scope="{record}">
      <a-input v-model="record.ocpcBid" @pressEnter="e=>updateCampaignOcpcBid(record.ocpcBid, record.campaignId, record.userName)"></a-input>
    </div>
  </CustomTable>
</template>

<script>
import CustomTable from '@/components/table/CustomTable'
import { getCampaignReportToday, getLastUpdateTime, updateCampaignPause, updateCampaignOcpcBid, getOptionSelectProduct, batchUpdateCampaignOcpcBid } from '@/api/dianshang/dianshang'
import columns from './columns'
import BudgetView from '@/pages/admin/shuju/components/shujuList/BudgetView' 
import ScheduleView from '@/pages/admin/shuju/components/shujuList/ScheduleView' 
import { getOptimizerList, getBdAccountList } from '@/api/xinxiliu/account'

export default {
  data() {
    return {
      columns,
      dataSource: [], // 数据
      dataSourceTotal: [], //数据，用于搜索
      lastUpdateTime: '', //上次更新时间
      selectedRowKeys: [], // 选中项
      selectedRowsForId:[],
      keyWord: '', // 搜索，关键词
      campaignStatus: -1, // 搜索，状态
      changeKey:'cost',
      changeOrder: 'DESC',
      showHB: true, //是否展示环比
      loading: false,
      page:1,
      pageSize: 10,
      downloadDataSource: [],
      downloadTitle: '计划日报表',
      total: 0,
      accountData: [], //账号信息，用于筛选
      accountDataTotal: [],
      accountName: 0,
      youhuashi: [],//优化师列表
      admin_userid: 0,
      productList:[],
      product_name: 0,
      showChangeOcpcBid: false,
      ocpcBid:0,
    }
  },
  created() { 
    this.init()
  },
  methods: {
    init() {
      this.getUserData()
      this.getAccountData()
      this.getOptimizerList()
      this.getProductList()
    },
    getUserData() {
      // 获取数据
      this.loading = true;
      this.selectedRowsForId = []
      let params = {
        page: this.page,
        pagesize: this.pageSize,
        column:this.changeKey,
        sortrule:this.changeOrder
      }
      if (this.accountName != 0) {
        params.account = this.accountName
      }
      if (this.admin_userid != 0) {
        params.admin_userid = this.admin_userid
      }
      if (this.product_name != 0) {
        params.product_name = this.product_name
      }
      if (this.campaignStatus != -1) {
        params.campaignStatus = this.campaignStatus
      }
      this.selectedRowKeys = []
      getCampaignReportToday(params).then((res) => {  
        this.getLastUpdateTime()
        this.loading = false;
        if(res.errcode == 0){
          this.dataSource = res.data.list
          this.dataSourceTotal = res.data.list
          this.total = res.data.total
          this.setHuanbi()
          // this.goSearch()
        }
      });
    },
    getAccountData() {
      // 获取账户信息
      getBdAccountList({}).then((res) => {
        if(res.errcode == 0){
          let arr = []
          for(let i of res.data){
            if(i.pid != 0){
              arr.push(i)
              // arr.push({
              //   account: i,
              //   id: i
              // })
            }
          }
          this.accountData = arr.slice(0, 100)
          this.accountDataTotal = arr
        }
      });
    },
    getOptimizerList(){
      // 获取优化师列表
      getOptimizerList({}).then((res) => {
        if(res.errcode == 0){
          this.youhuashi = res.data
        }
      });
    },
    getProductList() {
      // 获取商品列表
      let params = {
        page: 1,
        pagesize: 99999,
      }
      getOptionSelectProduct(params).then((res) => {
        if(res.errcode == 0){
          this.productList = res.data
        }
      }).catch(() => {
      });
    },
    getLastUpdateTime(){
      getLastUpdateTime({}).then((res) => {
        if(res.errcode == 0){
          this.lastUpdateTime = res.data[1].lasttime
        }
      }).catch(() => {
        
      });
    },
    changeCampaign(pause){
      let params = {
        pause: pause,
        campaignShoppingTypes:[]
      }
      params.campaignShoppingTypes = this.selectedRowsForId.map(e=>{
        return {
          campaignShoppingId: e.id,
          userName: e.userName,
        }
      })
      const hide = this.$message.loading('操作中')
      updateCampaignPause(params).then(() => {
        hide()
        this.init()
      }).catch(() => {
        hide()
        this.init()
      });
    },
    setOcpcBid() {
      this.showChangeOcpcBid = true
    },
    changeOcpcBid() {
      let params = {
        ocpcBid: this.ocpcBid,
        campaignShoppingTypes:[]
      }
      params.campaignShoppingTypes = this.selectedRowsForId.map(e=>{
        return {
          campaignShoppingId: e.id,
          userName: e.userName,
        }
      })
      const hide = this.$message.loading('操作中')
      batchUpdateCampaignOcpcBid(params).then(() => {
        hide()
        this.getUserData()
        this.showChangeOcpcBid = false
      }).catch(() => {
        hide()
        this.getUserData()
        this.showChangeOcpcBid = false
      });
    },
    changePause(item, status) {
      let params = {
        pause: status?0:1,
        campaignShoppingTypes: [
          {
            campaignShoppingId: item.campaignId,
            userName: item.userName,
          }
        ]
      }
      const hide = this.$message.loading('操作中')
      updateCampaignPause(params).then(() => {
        hide()
        this.init()
      }).catch(() => {
        hide()
        this.init()
      });
    },
    actionFunc(value){
      switch(value){
        case 1:
          this.changeCampaign(1)
        break;
        case 2:
          this.changeCampaign(0)
        break;
        case 3:
          this.setOcpcBid() // 修改出价
        break;
      }
    },
    setHuanbi() {
      const data = this.dataSource
      let idx = 1
      for(let item of data){
        item.id = idx
        item.pause = item.pause == 1?false:true
        let huanbi = {
          act: this.getHuanbi(item,'act'),
          click: this.getHuanbi(item,'click'),
          cost: this.getHuanbi(item,'cost'),
          cpc: this.getHuanbi(item, 'cpc'),
          dsOcpcConversionsDetail: this.getHuanbi(item, 'dsOcpcConversionsDetail'),
          dsOcpcConversionsDetailCost: this.getHuanbi(item, 'dsOcpcConversionsDetailCost'),
          dsOcpcConversionsDetail80: this.getHuanbi(item,'dsOcpcConversionsDetail80'),
          dsOcpcConversionsDetail90: this.getHuanbi(item,'dsOcpcConversionsDetail90'),
          dsOcpcConversionsDetail80Cost: this.getHuanbi(item,'dsOcpcConversionsDetail80Cost'),
          dsOcpcConversionsDetail90Cost: this.getHuanbi(item,'dsOcpcConversionsDetail90Cost'),
          ctr: this.getHuanbi(item,'ctr'),
          impression: this.getHuanbi(item, 'impression'),
          ds_cvr: this.getHuanbi(item, 'ds_cvr'),
          roi: this.getHuanbi(item, 'roi'),
          dsOcpcConversionsDetailAmount: this.getHuanbi(item, 'dsOcpcConversionsDetailAmount'),
        }
        item.huanbi = huanbi
        idx++
      }
    },
    getHuanbi(item,key){
      let today = item[key]?item[key]:0
      let yesdata = item.yesdata?item.yesdata[key]?item.yesdata[key]:0:0
      let huanbi = '-'
      if(yesdata != 0 && today != 0){
        huanbi = (today - yesdata)/yesdata*100
        huanbi = huanbi.toFixed(2)
      }else if(yesdata == 0 && today == 0){
        huanbi = 0
      }
      return huanbi + '%'
    },
    goSearch() {
      this.selectedRowKeys = []
      this.selectedRowsForId = []
      let keyWord = this.keyWord
      let campaignStatus = this.campaignStatus
      let dataSourceTotal = JSON.parse(JSON.stringify(this.dataSourceTotal)) 
      // console.log(keyWord, dataSourceTotal, dataSourceTotal.filter(o=>o.userName == keyWord))
      if(keyWord == '' && campaignStatus == -1){
        this.dataSource = dataSourceTotal
      }else if(keyWord == '' && campaignStatus != -1){
        this.dataSource = dataSourceTotal.filter(o=>o.campaignStatus == campaignStatus)
      }else if(keyWord != '' && campaignStatus == -1){
        this.dataSource = dataSourceTotal.filter(o=>o.userName == keyWord)
      }else{
        this.dataSource = dataSourceTotal.filter(o=>o.userName == keyWord && o.campaignStatus == campaignStatus)
      }
      this.setDownloadData()
    },
    accountSelectSearch(value) {
      if (value != '') {
        this.accountData = this.accountDataTotal.filter(e=>e.account.indexOf(value) >= 0).slice(0, 100)
      } else {
        this.accountData = this.accountDataTotal.slice(0, 100)
      }
    },
    updateCampaignOcpcBid(ocpcBid, campaignId, userName) {
      // 更新出价
      const params = {
        campaignId,
        userName,
        ocpcBid,
      }
      const hide = this.$message.loading('更新中')
      updateCampaignOcpcBid(params).then(() => {
        hide()
      }).catch(() => {
        hide()
      });
    },
    selectedRowChange(selectedRowKeys, selectedRows){
      // console.log('selectedRowChange',selectedRowKeys, selectedRows)
      this.selectedRowsForId = selectedRows.map(e=>{
        return {
          id: e.campaignId,
          userName: e.userName
        }
      })
    },
    setDownloadData() {
      const downloadDataSource = []
      const downloadColumns = ['campaignNameStatus', 'userName', 'campaignStatus', 'bidType', 'ocpcBid', 'budget', 'schedule', 'cost', 'ds_cvr', 'dsOcpcConversionsDetail', 'dsOcpcConversionsDetailCost']
      const HuanbiKeys = ['cost', 'ds_cvr', 'dsOcpcConversionsDetail', 'dsOcpcConversionsDetailCost']  // 要添加环比的key
      let titleArray = []
      for (let key of downloadColumns) {
        let title = this.columns.find(e => e.dataIndex == key)['title']
        titleArray.push(title)
        if (HuanbiKeys.includes(key)) {
          titleArray.push(title+'环比')
        }
      }
      downloadDataSource.push(titleArray)
      for (let item of this.dataSource) {
        let arr = []
        for (let key of downloadColumns) {
          if (HuanbiKeys.includes(key)) {
            switch (key) {
              case 'ds_cvr': {
                arr.push((item[key]*100).toFixed(2) + '%')
                break;
              }
              case 'dsOcpcConversionsDetail': {
                arr.push(item[key])
                break;
              }
              default: {
                arr.push(item[key].toFixed(2))
                break;
              }
            }
            arr.push(item.huanbi[key])
          } else {
            switch (key) {
              case 'budget': {
                const res = item[key] == 0 ? '不限' : (item[key]).toFixed(2)
                arr.push(res)
                break;
              }
              case 'schedule': {
                const schedule = item[key] != '' ? JSON.parse(item[key]) : []
                if (schedule.length > 0) {
                  arr.push('指定时段')
                } else {
                  arr.push('全天推广')
                }
                break;
              }
              case 'campaignStatus': {
                arr.push(this.setStatus(item[key]))
                break;
              }
              case 'bidType': {
                arr.push(this.getBidType(item[key]))
                break;
              }
              
              default: {
                // console.log(key) 
                arr.push(item[key])
                break;
              }
            }
          }
        }
        downloadDataSource.push(arr)
      }
      // console.log(downloadDataSource)
      this.downloadDataSource = downloadDataSource
    },
    getSorter(sorter){
      if(sorter.column){
        this.changeKey = sorter.column.dataIndex
        switch(sorter.order){
          case "ascend":
            this.changeOrder = 'ASC'
            break
          case "descend":
            this.changeOrder = 'DESC'
            break
        }
        this.init()
      }else{
        this.changeKey = ''
        this.changeOrder = ''
      }
    },
    onChange(pagination) {
      console.log(pagination)
      // if(this.page == pagination.current){
      //   if(!this.pageSize == pagination.pageSize){
      //   }
      // }
      this.pageSize = pagination.pageSize
      this.page = pagination.current
      this.getUserData()
    },
    setStatus(e){
      switch(e){
        case 0: case '0':
          return '有效'
        case 1: case '1':
          return '处于暂停时段'
        case 2: case '2':
          return '暂停'
        case 3: case '3':
          return '预算不足'
        case 10: case '10':
          return '账户预算不足'
        case 11: case '11':
          return '账户余额为零'
        case 20: case '20':
          return '审核中'
        case 21: case '21':
          return '审核不通过'
        case 22: case '22':
          return '部分有效'
        case 30: case '30':
          return '商品已失效'
        default:
          return '未知'
      }
    },
    getBidType(e){
      switch(e){
        case 1: case '1':
          return '控成本模式'
        case 4: case '4':
          return '放量模式'
        default:
          return '未知'
      }
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
  },
  filters: {
    
  },
  components:{CustomTable,BudgetView,ScheduleView},
}
</script>

<style lang="less" scoped>
  .searchView{
    margin-left: 12px;
  }
  .old_data{
    font-size: 14px;
    display: flex;
    align-items: center;
    img{
      width: 24px;
      height: 24px;
      margin-right: 4px;
    }
  }
  .line1{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .fontGreen{
    margin-left: 10px;
    color: #41b883;
  }
  .fontRed{
    margin-left: 10px;
    color: #c96168;
  }
  .card{
    margin-bottom: 20px;
  }
  .search{
    margin-bottom: 54px;
  }
  .fold{
    width: calc(100% - 216px);
    display: inline-block
  }
  .operator{
    margin-bottom: 18px;
  }
  @media screen and (max-width: 900px) {
    .fold {
      width: 100%;
    }
  }
</style>
<style>
.card .ant-divider-horizontal{
  margin: 7px 0;
}
</style>